package com.dailyblue.java.spring.mvc.controller;

import com.dailyblue.java.spring.mvc.bean.Users;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

@RequestMapping("/second")
@Controller
public class SecondController {

    // 接收参数
    @RequestMapping(value = "/a", method = RequestMethod.GET)
    public String a(String name) {
        System.out.println("进入了SecondController`a!param:" + name);
        return "1";
    }

    @GetMapping("/b")
    public String b(Integer a, String b, double c, char d) {
        System.out.println("进入了SecondController`b!param:" + a + "," + b + "," + c + "," + d);
        return "1";
    }

    @GetMapping("/c")
    public String c(@RequestParam(name = "c") String b) {
        System.out.println("进入了SecondController`c!param:" + b);
        return "1";
    }

    @GetMapping("/d")
    public String d(@RequestParam(name = "p", defaultValue = "1") int page) {
        System.out.println("进入了SecondController`d!param:" + page);
        return "1";
    }
    @GetMapping("/e")
    public String e(Users user) {
        System.out.println("进入了SecondController`e!param:" + user);
        return "1";
    }
}
